//https://leetcode.cn/problems/valid-palindrome/
//验证字符串是否回文

class Solution {
public:
    bool isWord(char& ch)
    {
        if(ch >= 'a' && ch <= 'z' || ch >= '0' && ch <= '9')
        return true;
        else if(ch >= 'A' && ch <= 'Z')
        {
            ch -= 'A' - 'a';
            return true;
        }

        return false;
    }

    bool isPalindrome(string s) {
        int left = 0, right = s.size() - 1;
        while(left < right)
        {
            while(left < right && !isWord(s[left]))
            {
                left++;
            }

            while(left < right && !isWord(s[right]))
            {
                right--;
            }

            if(s[left] != s[right])
            return false;

            left++;
            right--;
        }

        return true;
    }
};